package main

import "fmt"

func main() {
	// map crud
	m := make(map[string]string)

	m["a"] = "aa" // add
	m["b"] = "bb" // add

	fmt.Println(m) // map[a:aa b:bb]

	m["a"] = "cc" // update

	fmt.Println(m) // map[a:cc b:bb]

	// delete(m, "a") // delete(map Type, key Type) delete key
	// fmt.Println(m) // map[b:bb]

	// find key
	val := m["b"]
	fmt.Println(val)

	if val, ok := m["cc"]; ok {
		fmt.Println(val)
	} else {
		fmt.Println("not find")
	}

	// for range
	for key, val := range m {
		fmt.Println(key, "->", val)
	}
}
